<cfajaximport tags="cfform,cftree,cfgrid,cftooltip,cfwindow,cflayout-tab">
<cfsetting showdebugoutput="no">
<html>

<head>
<title>cfproperty generator</title>
<link href="assets/css/style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
function setDSN(dsn) {
	ColdFusion.navigate('main.cfm?dsn='+escape(dsn),'main');
}
<!--- The error handler pops an alert with the error code and message. --->
    var myerrorhandler = function(errorCode,errorMessage){
        alert("[In Error Handler]" + "\n\n" + "Error Code: " + errorCode + "\n\n" + "Error Message: " + errorMessage);
    }
</script>
</head>

<body>

<cflayout type="border">

	<cflayoutarea position="top" maxsize="80" >

		<cfset datasources = structKeyList(application.dsObj.getDatasources())>

		<table width="100%" cellpadding="5" cellspacing="0" border="0" class="topbody">
		<tr>
		<td><span class="apptitle">Coldfusion cfproperties generator</span></td>
		<td align="right" valign="middle">
		<span class="dsselector">
			<select name="dsn" onchange="setDSN(this.options[this.selectedIndex].value)">
			<option value="">Select Datasource:</option>
			<cfloop list="#datasources#" index="dsn">
				<cfoutput><option value="#dsn#" <cfif session.dsn is dsn>selected="selected"</cfif> >#dsn#</option></cfoutput>
			</cfloop>
			</select>
			<a href="index.cfm?logout=youbet" title="[Logout]">[Logout]</a>
		</span>
		</td>
		</tr>
		</table>
	</cflayoutarea>
	<cfif len(session.dsn)>
		<cfset source = "main.cfm">
	<cfelse>
		<cfset source = "welcome.cfm">
	</cfif>
	<cflayoutarea position="center" name="main" source="#source#" />

</cflayout>

</body>
</html>